package com.zhengshang.api.service.impl;

import com.zhengshang.api.domain.AppNavigate;
import com.zhengshang.api.mapper.AppNavigateMapper;
import com.zhengshang.api.service.IAppNavigateService;
import com.zhengshang.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * app首页导航Service业务层处理
 *
 * @author zhengshang
 * @date 2022-04-07
 */
@Service
public class AppNavigateServiceImpl implements IAppNavigateService
{
    @Autowired
    private AppNavigateMapper appNavigateMapper;

    /**
     * 查询app首页导航
     *
     * @param navigateId app首页导航ID
     * @return app首页导航
     */
    @Override
    public AppNavigate selectAppNavigateById(Long navigateId)
    {
        return appNavigateMapper.selectAppNavigateById(navigateId);
    }

    /**
     * 查询app首页导航列表
     *
     * @param appNavigate app首页导航
     * @return app首页导航
     */
    @Override
    public List<AppNavigate> selectAppNavigateList(AppNavigate appNavigate)
    {
        return appNavigateMapper.selectAppNavigateList(appNavigate);
    }

    /**
     * 查询app首页导航列表
     *
     * @param appNavigate app首页导航
     * @return app首页导航
     */
    @Override
    public List<AppNavigate> queryAppNavigateList(AppNavigate appNavigate) {
        return appNavigateMapper.queryAppNavigateList(appNavigate);
    }

    /**
     * 新增app首页导航
     *
     * @param appNavigate app首页导航
     * @return 结果
     */
    @Override
    public int insertAppNavigate(AppNavigate appNavigate)
    {
        appNavigate.setCreateTime(DateUtils.getNowDate());
        return appNavigateMapper.insertAppNavigate(appNavigate);
    }

    /**
     * 修改app首页导航
     *
     * @param appNavigate app首页导航
     * @return 结果
     */
    @Override
    public int updateAppNavigate(AppNavigate appNavigate)
    {
        appNavigate.setUpdateTime(DateUtils.getNowDate());
        return appNavigateMapper.updateAppNavigate(appNavigate);
    }

    /**
     * 批量删除app首页导航
     *
     * @param navigateIds 需要删除的app首页导航ID
     * @return 结果
     */
    @Override
    public int deleteAppNavigateByIds(Long[] navigateIds)
    {
        return appNavigateMapper.deleteAppNavigateByIds(navigateIds);
    }

    /**
     * 删除app首页导航信息
     *
     * @param navigateId app首页导航ID
     * @return 结果
     */
    @Override
    public int deleteAppNavigateById(Long navigateId)
    {
        return appNavigateMapper.deleteAppNavigateById(navigateId);
    }

    /**
     * 修改状态
     * @param appNavigate
     * @return
     */
    @Override
    public int updateNavigateStatus(AppNavigate appNavigate) {
        return appNavigateMapper.updateAppNavigate(appNavigate);
    }

    @Override
    public AppNavigate findAppNavigateByCode(String navigateCode) {
        return appNavigateMapper.findAppNavigateByCode(navigateCode);
    }

    @Override
    public List<AppNavigate> selectAppNavigateByCodes(String navigateCodes) {
        String[] navigateCodArray = navigateCodes.split(",");
        return appNavigateMapper.selectAppNavigateByCodes(navigateCodArray);
    }
}
